fix: use annotation for MirageOS net device name#690
Conversation
Fixes: urunc-dev#315 Signed-off-by: viju <avijusanjai@gmail.com>
✅ Deploy Preview for urunc canceled.
|
|
Hello @pocopepe , this is not enough testing for such PR. You need to build a mirage unikernel with multiple network interfaces and then spawn it with urunc again with multiple network interfaces. |
|
My bad, I just tested it with a mirage unikernel built to declare a non default net device name being eth0 being With the annotation: $ sudo nerdctl run --rm --runtime io.containerd.urunc.v2 neteth0:fix
WARN[0000] cannot set cgroup manager to "systemd" for runtime "io.containerd.urunc.v2"
| ___|
__| _ \ | _ \ __ \
\__ \ ( | | ( | ) |
____/\___/ _|\___/____/
Solo5: Bindings version v0.10.1
Solo5: Memory map: 268 MB addressable:
...
Usage: neteth0 [--help] [OPTION]…
neteth0: unknown option '--ipv4' unknown option '--ipv4-gateway'
Solo5: solo5_exit(64) calledsolo5 accepts Without the annotation: $ sudo nerdctl run --rm --runtime io.containerd.urunc.v2 neteth0:bug
WARN[0000] cannot set cgroup manager to "systemd" for runtime "io.containerd.urunc.v2"
solo5-hvt: Resource not declared in manifest: 'service'
solo5-hvt: Resource not declared in manifest: 'service'
solo5-hvt: Invalid option: `--net:service=tap0_urunc'urunc defaults to the old hardcoded |
|
Thank you @pocopepe for the test. Would it be possible to share the image you built? Also, a small note: If the PR does not entirely fix an issue, you can mention the issue as related, but do not use "Fixes". |
|
@cmainas sorry, I assumed Fixes was part of the default template, new to the repo conventions. happy to amend the commit and update the pr description to use Related instead, want me to do that now? Pushed images: |
Description
mirageos unikernels declare their network device names at build time through the solo5 manifest. the problem was urunc always hardcoded "service" as the device name, so if you built a unikernel with a different name it would just fail.
i added a new annotation
com.urunc.unikernel.netDevso image builders can set the name at build time and urunc picks it up at runtime. if the annotation isn't there it falls back to "service" so existing images still work.block device naming and multi network support i left for follow up prs as discussed.
Related issues
How was this tested?
go test ./pkg/unikontainers/unikernels/... -v -run TestMirageNetDevName === RUN TestMirageNetDevName === RUN TestMirageNetDevName/uses_net_device_name_from_annotation === PAUSE TestMirageNetDevName/uses_net_device_name_from_annotation === RUN TestMirageNetDevName/falls_back_to_service_when_annotation_is_absent === PAUSE TestMirageNetDevName/falls_back_to_service_when_annotation_is_absent === CONT TestMirageNetDevName/uses_net_device_name_from_annotation === CONT TestMirageNetDevName/falls_back_to_service_when_annotation_is_absent --- PASS: TestMirageNetDevName (0.00s) --- PASS: TestMirageNetDevName/uses_net_device_name_from_annotation (0.00s) --- PASS: TestMirageNetDevName/falls_back_to_service_when_annotation_is_absent (0.00s) PASS ok github.com/urunc-dev/urunc/pkg/unikontainers/unikernels (cached)LLM usage
Claude Sonnet 4.6
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).